<template>
	<view class="content">
		<u-navbar fixed :leftIcon="null" title="我的"></u-navbar>
		<view class="top-content">
			<view class="user-info">
				<view class="avatar-content">
					<u--image width="100rpx" height="100rpx"
						src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"
						shape="circle"></u--image>
				</view>
				<view class="right-content">
					<view class="name-content"> {{ getUserInfo().nickName || "夏琳恒"  }} <span class="post">心内科·主任医师</span>
					</view>
					<view class="info-content">浙江省人民医院（天府院区）</view>
				</view>
			</view>
		</view>
		<view class="bottom-content">
			<view class="btn-content">
				<u-button text="退出登录" @click="showModal = true"></u-button>
			</view>
		</view>
		<u-modal :show="showModal" title="退出登录提示" showCancelButton @confirm="logout" content="您确定退出登录吗？"
			@cancel="showModal = false"></u-modal>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				showModal: false
			}
		},

		methods: {
			getUserInfo() {
				const info = uni.getStorageSync('userInfo');
				const userInfo = info.user || {};
				return userInfo;
			},
			logout() {
				uni.navigateTo({
					url: "/pages/login/login"
				})
				uni.clearStorage()
			},
		}
	}
</script>

<style scoped lang="scss">
	.content {
		padding-top: 126rpx;
		position: relative;
		height: 90vh;

		.top-content {
			background-color: aquamarine;
			padding: 24rpx;

			.user-info {
				display: flex;
				align-items: center;
				background-color: #fff;
				border-radius: 12rpx;
				padding: 12rpx;

				.right-content {
					margin-left: 24rpx;
					font-size: 28rpx;

					.name-content {
						font-weight: 600;

						.post {
							margin-left: 24rpx;
							color: #333;
							font-size: 24rpx;
							font-weight: 500;
						}
					}


					.info-content {
						margin-top: 12rpx;
					}
				}
			}
		}

		.bottom-content {
			position: absolute;
			bottom: 120rpx;
			width: 100%;
			display: flex;
			justify-content: center;

			.btn-content {
				width: 80%;
			}
		}
	}
</style>